// import store from '../index'
const app = {
  namespaced: true,
  state: {
    userInfo: null,
    user: ''
  },
  mutations: {
    SET_USER_INFO (state, data) {
      state.userInfo = data
    },
    RESET_USER_STATE (state, data) {
      state = resetState(state)
      console.log(state)
    }
  },
  actions: {
  },
  getters: {
    arrangeInterviewSwitch: state => state.arrangeInterviewSwitch
  }
}
function resetState (state) {
  Object.keys(state).forEach(key => {
    if (Array.isArray(state[key])) {
      state[key] = []
    } else if (Object.prototype.toString.call(state[key]) === '[object Object]') {
      resetState(state[key])
    } else if (typeof state[key] === 'boolean') {
      state[key] = false
    } else {
      state[key] = ''
    }
  })
  return state
}
export default app
